package day7;

import java.util.*;

public class Demo3 {

    public static void main(String[] args) {
        List list = new ArrayList();
        list.add(new Person("老王", 1));
        list.add(new Person("老王", 1));
        list.add(new Person("老张", 2));

        Set se = new HashSet();

        List list2 = new ArrayList();
        for (Object cd : list){
            if (se.add(cd)) {
                list2.add(cd);
            }
        }

        System.out.println(list2.size());

        System.out.println(list2);

    }
}
